<?php
namespace app\common\model;

use think\Model;

/**
 * 配置模型
 * User: PunkVv <punkvv@qq.com>
 * Date: 2016/7/7
 * Time: 10:52
 */
class Config extends Model
{

    /**
     * 批量修改配置值
     * @param $array
     */
    public function setBatch($array)
    {
        foreach ($array as $key => $val) {
            $this->save(['value' => $val], ['name' => $key]);
        }
    }

    /**
     * 获取配置值
     * @param $ids
     * @return array
     */
    public function getValues($ids)
    {
        return $this->where('id', 'in', $ids)->column('name,value');
    }
}